<template>
    <div id="patrol-scheme" class="w-h-100 pos-r flex-1 apply-container page-public-s" style="box-sizing: border-box;overflow:hidden;">
        <div class="w-h-100 ver-flex pos-a" style="box-sizing: border-box; padding: 6px;">
            <div v-if="$hasPer('PatrolScheme:add') || $hasPer('PatrolScheme:batchStart') || $hasPer('PatrolScheme:batchEnd') || $hasPer('PatrolScheme:excel')" style="box-sizing: border-box;">
                <el-card shadow="never" :body-style="{ paddingBottom: '0' }">
                    <el-form class="box-f" ref="queryForm" :inline="true">
                        <el-form-item>
                            <el-button v-if="$hasPer('PatrolScheme:add')" @click="nodeClick('')" icon="ele-Plus" type="primary"> 新增 </el-button>
                            <el-button @click="syncHandle(getData)" icon="ele-Refresh"> 批量同步 </el-button>
                            <el-button v-if="$hasPer('PatrolScheme:batchStart')"  @click="batchHandle(1,getData)" icon="ele-Refresh"> 批量启用 </el-button>
                            <el-button v-if="$hasPer('PatrolScheme:batchEnd')"  @click="batchHandle(2,getData)" icon="ele-Refresh"> 批量停用 </el-button>
                            <el-button v-if="$hasPer('PatrolScheme:excel')" @click="handleExport" icon="ele-Download"> 导出数据 </el-button>
                        </el-form-item>
                    </el-form>
                </el-card>
            </div>

            <div style="box-sizing: border-box;" class="flex-1 pos-r">
                <div class="pos-a w-h-100" style="box-sizing: border-box;">
                    <el-card class="box-card w-h-100" shadow="never" style="margin-top: 16px;">
                        <div style="" class="w-h-100 ver-flex">
                            <div class="flex-1 pos-r">
                                <div class="pos-a w-h-100">
                                    <el-table 
                                        ref="excelRef"
                                        :data="list" 
                                        class="w-h-100" 
                                        style="width: 100%" 
                                        border 
                                        v-loading="loading" 
                                        element-loading-background="rgba(0, 0, 0, 0.5)"
                                        @selection-change="handleSelectionChange"
                                    >
                                        <el-table-column 
                                            type="selection" 
                                            width="55" 
                                            fixed="left"
                                        />

                                        <el-table-column width="80" :show-overflow-tooltip="true" label="待同步"  align="center">
                                            <template #default="scope">
                                                <span style="color: #67C23A;" v-if="scope.row.isTobeDS">是</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="计划名称"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="i_Name" typeVal="input" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_Name">{{ scope.row.v_Name }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检路线名称"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Path" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_IPPathName">{{ scope.row.v_IPPathName }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="风险分区"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Risk" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_RiskPartitionName">{{ scope.row.v_RiskPartitionName }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <!-- <el-table-column min-width="200" :show-overflow-tooltip="true" prop="" label="巡检分类"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Class" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span style="color: #E6A23C;" v-if="scope.row.n_IPClass === 0">{{ scope.row.v_IPClassName }}</span>
                                                    <span style="color: #67C23A;" v-if="scope.row.n_IPClass === 1">{{ scope.row.v_IPClassName }}</span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column> -->

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检类型"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Type" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_IPType">{{ scope.row.v_IPType }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检模式"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Mode" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_IPModeName">{{ scope.row.v_IPModeName }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检周期值"  align="center" prop="n_IPCycleVaule" sortable>
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="i_Cycle" typeVal="input" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.n_IPCycleVaule">{{ scope.row.n_IPCycleVaule }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检时间单位"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Unit" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_IPCycleUintName">{{ scope.row.v_IPCycleUintName }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column width="230" :show-overflow-tooltip="true" label="开始日期"  align="center" prop="d_StartDate" sortable>
                                            <el-table-column :show-overflow-tooltip="true" width="230" align="center">
                                                <template #header>
                                                    <SearchModel typeId="d_Start" typeVal="date" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.d_StartDate">{{ scope.row.d_StartDate.split(' ')[0] }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column width="230" :show-overflow-tooltip="true" label="结束日期"  align="center" prop="d_EndDate" sortable>
                                            <el-table-column :show-overflow-tooltip="true" width="230" align="center">
                                                <template #header>
                                                    <SearchModel typeId="d_End" typeVal="date" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.d_EndDate">{{ scope.row.d_EndDate.split(' ')[0] }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="重复几次结束"  align="center" prop="n_RepetitionTimesEnd" sortable>
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="i_Repetition" typeVal="input" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.n_RepetitionTimesEnd">{{ scope.row.n_RepetitionTimesEnd }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检开始时间"  align="center" prop="d_StartTime" sortable>
                                            <template #default="scope">
                                                <span v-if="scope.row.d_StartTime">{{ new Date(scope.row.d_StartTime).toLocaleTimeString() }}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检结束时间"  align="center" prop="d_EndTime" sortable>
                                            <template #default="scope">
                                                <span v-if="scope.row.d_EndTime">{{ new Date(scope.row.d_EndTime).toLocaleTimeString() }}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="工作日历名称"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Work" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_WorkingCalendarName">{{ scope.row.v_WorkingCalendarName }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="是否启动巡检路线顺序"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Order" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.isUsedPathUnitOrder" style="color: #67C23A;">是</span>
                                                    <span v-else style="color: #E6A23C;">是</span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="是否启动巡检定位"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Location" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.isUsedLocation" style="color: #67C23A;">是</span>
                                                    <span v-else style="color: #E6A23C;">是</span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检允许提前时间值"  align="center" prop="n_AllowEarlyValue" sortable>
                                            <template #default="scope">
                                                <span v-if="scope.row.n_AllowEarlyValue">{{scope.row.n_AllowEarlyValue}}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检允许提前时间单位"  align="center">
                                            <template #default="scope">
                                                <span v-if="scope.row.v_AllowEarlyUnitName">{{scope.row.v_AllowEarlyUnitName}}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检允许延后时间值"  align="center" prop="n_AllowDelayedValue" sortable>
                                            <template #default="scope">
                                                <span v-if="scope.row.n_AllowDelayedValue">{{scope.row.n_AllowDelayedValue}}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检延后时间单位"  align="center">
                                            <template #default="scope">
                                                <span v-if="scope.row.v_AllowDelayedUnitName">{{scope.row.v_AllowDelayedUnitName}}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" prop="" label="任务生成模式"  align="center">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_Task" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_TaskGenerateModelName">{{ scope.row.v_TaskGenerateModelName }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="200" :show-overflow-tooltip="true" label="巡检记录状态"  align="center" fixed="right">
                                            <el-table-column :show-overflow-tooltip="true" min-width="200" align="center">
                                                <template #header>
                                                    <SearchModel typeId="s_State" typeVal="select" @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="scope">
                                                    <span v-if="scope.row.n_State === 1" style="color: #67C23A;">{{ scope.row.v_StateName }}</span>
                                                    <span v-if="scope.row.n_State === 0" style="color: #E6A23C;">{{ scope.row.v_StateName }}</span>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>

                                        <el-table-column min-width="180" :show-overflow-tooltip="true" prop="createdTime" label="创建时间"  align="center" sortable>
                                            <template #default="scope">
                                                <span v-if="scope.row.createdTime">{{ scope.row.createdTime }}</span>
                                                <span v-else>-</span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column min-width="180" :show-overflow-tooltip="true" prop="updatedTime" label="更新时间"  align="center" sortable>
                                            <template #default="scope">
                                                <span v-if="scope.row.updatedTime">{{ scope.row.updatedTime }}</span>
                                                <span v-else>-</span>
                                            </template>
                                        </el-table-column>

                                        <!-- <el-table-column min-width="180" :show-overflow-tooltip="true" label="巡检计划任务分配人员"  align="center">
                                            <template #default="scope">
                                                <el-select 
                                                    filterable 
                                                    v-model="scope.row.smsipPlanUsers" 
                                                    placeholder="巡检计划任务分配人员"
                                                >
                                                    <el-option
                                                        v-for="item in scope.row.smsipPlanUsers"
                                                        :key="item.l_UserId"
                                                        :label="item.v_UserName"
                                                        :value="item.l_UserId"
                                                    />
                                                </el-select>
                                            </template>
                                        </el-table-column> -->

                                        <!-- <el-table-column min-width="180" :show-overflow-tooltip="true" label="巡检计划任务分配班组"  align="center">
                                            <template #default="scope">
                                                <el-select 
                                                    filterable 
                                                    v-model="scope.row.smsipPlanTeamGroups" 
                                                    placeholder="巡检计划任务分配班组"
                                                >
                                                    <el-option
                                                        v-for="item in scope.row.smsipPlanTeamGroups"
                                                        :key="item.l_TeamGroupId"
                                                        :label="item.v_TeamGroupName"
                                                        :value="item.l_TeamGroupId"
                                                    />
                                                </el-select>
                                            </template>
                                        </el-table-column> -->

                                        <!-- <el-table-column min-width="180" :show-overflow-tooltip="true" label="巡检计划任务分配岗位"  align="center">
                                            <template #default="scope">
                                                <el-select 
                                                    filterable 
                                                    v-model="scope.row.smsipPlanPoss"
                                                    placeholder="巡检计划任务分配岗位"
                                                >
                                                    <el-option
                                                        v-for="item in scope.row.smsipPlanPoss"
                                                        :key="item.l_PosId"
                                                        :label="item.v_PosName"
                                                        :value="item.l_PosId"
                                                    />
                                                </el-select>
                                            </template>
                                        </el-table-column> -->
                                        
                                        <el-table-column min-width="180" :show-overflow-tooltip="true" label="最后一次同步时间"  align="center">
                                            <template #default="scope">
                                                <span v-if="scope.row.d_InitiateDSTime">{{ scope.row.d_InitiateDSTime }}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>
                                        
                                        <el-table-column width="180" :show-overflow-tooltip="true" label="发起同步时间"  align="center">
                                            <template #default="scope">
                                                <span v-if="scope.row.d_InitiateDSTime">{{ scope.row.d_InitiateDSTime }}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>

                                        <el-table-column width="260" label="操作" align="center" fixed="right">
                                            <el-table-column :show-overflow-tooltip="true" min-width="260" align="center">
                                                <template #header>
                                                    <el-button class="icon-e" @click='searchClick' icon="ele-Search" size="small" text type="primary"> 查询 </el-button>
                                                    <el-button class="icon-e clear-bg" style="background-color: transparent !important;" size="small" @click="resetClick" icon="ele-Refresh" text> 重置 </el-button>
                                                </template>
                                                <template #default="scope">
                                                    <div class="operate-s">
                                                        <el-button @click="detailHandle(scope.row.id)" class="icon-e" icon="ele-View" size="small" text type="success">详情</el-button>
                                                        <el-button v-if="scope.row.n_State === 0 && $hasPer('PatrolScheme:planStart')" @click="documentClick(scope.row,getData)" class="icon-e" icon="ele-Discount" size="small" text type="primary">计划启用</el-button>
                                                        <el-button v-if="scope.row.n_State === 1 && $hasPer('PatrolScheme:planEnd')" @click="documentClick(scope.row, getData)" class="icon-e" icon="ele-Discount" size="small" text type="warning">计划停用</el-button>
                                                        <el-button v-if="scope.row.n_State === 0 && $hasPer('PatrolScheme:edit')" @click="nodeClick(scope.row)" class="icon-e" icon="ele-Edit" size="small" text type="warning">编辑</el-button>
                                                        <el-button v-if="scope.row.n_State === 0 && $hasPer('PatrolScheme:del')" @click="deleteHandle(scope.row.id, getData)" class="icon-e" icon="ele-Delete" size="small" text type="danger">删除</el-button>
                                                    </div>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table>
                                </div>
                            </div>
                            <div style="height: 30px;margin-top: 20px;" class="hr-flex-start">
								<el-pagination
									v-model:currentPage="pageNo"
									v-model:page-size="pageSize"
									:total="totalRows"
									:page-sizes="[10, 20, 50, 100]"
									small
									background
									@size-change="handleSizeChange"
									@current-change="handleCurrentChange"
									layout="total, sizes, prev, pager, next, jumper"
									class="w-h-100"
								/>
							</div>
                        </div>
                    </el-card>
                </div>
            </div>
        </div>
        <AddEditPatrolScheme
            preType="equ"
            :repairInfo="repairInfo"
            :isUseDialog="isUseDialog"
            @updateData="getData"
            @cancelUseClick="cancelUseClick"
            @controlUseClick="controlUseClick"
        />
        <!-- 详情 -->
        <DetailModel
            :detailInfo="detailInfo"
            :MdetailDialog="MdetailDialog"
            labelWidth="170px"
            @cancelDetailClick="cancelDetailClick"
        />
    </div>
</template>
<script lang="ts">
import { defineComponent, ref, Ref, onMounted , reactive , toRaw } from 'vue';
import getTableData from '/@/utils/getTableData';
import { 
    SMSIPPlanPage , 
    SMSIPPlanDelete , 
    SMSIPPlanUpdateState ,
    SMSIPPathList,
    SMSDCRiskPartitionList,
    sysDictDataList,
    SMSIPPlanDetail,
    SMSDCSysDSTaskMaBathAddTasks,
} from '/@/api/centerControl/sms';
import AddEditPatrolScheme from '../component/sms/add-edit-PatrolScheme.vue';
import { ElMessageBox , ElMessage } from 'element-plus';
import SearchModel from '../component/search-model.vue';
import DetailModel from '../component/detail-model.vue';
import { confirmFun } from '../component/messageTs';
import { exportToExcel } from '/@/utils/exportToExcel';

export default defineComponent( {
    name: 'patrol-scheme',
    components: {
        AddEditPatrolScheme,
        SearchModel,
        DetailModel,
    },
    setup(props){
        const isUseDialog = ref() // 新增/编辑弹出框隐藏/显示
        const repairInfo = ref() // 传递子组件数据
        let multipleSelection: any = [];

        /*** 批量同步数据按钮 */
        const syncHandle = (uploadFun: Function) => {
            let setArr: any = [];
            if(multipleSelection.length === 0){
                ElMessage({
                    type: 'warning',
                    message: '请选择需同步的数据',
                });
                return;
            }else{
                confirmFun('是否批量同步已选数据，注意：该操作仅同步已启用的数据。','提示','warning','取消').then(async(isConfirmed: any) => {
                    if(isConfirmed){
                        multipleSelection.map((item: any) => {
                            if(item.n_State === 1 || item.d_LastDSTime !== null){
                                setArr.push(item.id);
                            }
                        });
                        let res: any = await SMSDCSysDSTaskMaBathAddTasks({ n_DCSysDSTaskType: 3, l_AppInstanceIds: setArr });
                        if(res.success) uploadFun();
                    }
                });
            }
        }

        /*** nodeClick 新增/编辑点击事件 */
        const nodeClick = (val:string | object) => {
            val !== '' ? repairInfo.value = JSON.stringify(toRaw(val)) : repairInfo.value = ''
            isUseDialog.value = true
        };

        /*** 复选框禁用 */
        const selectable = (row: any,index: number) => {
            // console.log(row,'row')
            // console.log(index,'index')
        }
        
        /*** handleSelectionChange 批量更新的复选框 */
        const handleSelectionChange = (val: any) => {
            multipleSelection = val;
        }
        /*** batchHandle  批量启用/停用 */
        const batchHandle = (num: number, uploadFun: Function) => {
            let param: any = {};
            let setArr:any = [];
            if(multipleSelection.length === 0){
                ElMessage({
                    type: 'warning',
                    message: '请选择需要更新的数据',
                });
                return;
            }else{
                multipleSelection.map((item: any) => {
                    setArr.push(item.id);
                });
                param.l_Ids = setArr;
            }
            if(num === 1){
                confirmFun('是否批量启用数据？','提示','warning','取消').then((isConfirmed: any) => {
                    if(isConfirmed){
                        param.n_State = 1;
                        startEndFun(JSON.stringify(param),uploadFun);
                    }
                });
            }else{
                confirmFun('是否批量停用数据？','提示','warning','取消').then((isConfirmed: any) => {
                    if(isConfirmed){
                        param.n_State = 0;
                        startEndFun(JSON.stringify(param),uploadFun);
                    }
                });
            }
        }
        /*** documentClick 单条数据启用/停用 */
        const documentClick = (val:any , uploadFun: Function) => {
            let param:any = {};
            let setArr = [];
            setArr.push(val.id);
            param.l_Ids = setArr;
            if(val.n_State === 0) {
                confirmFun('是否启用该条数据？','提示','warning','取消').then((isConfirmed: any) => {
                    if(isConfirmed){
                        param.n_State = 1;
                        startEndFun(JSON.stringify(param),uploadFun);
                    }
                });
            }else {
                confirmFun('是否停用该条数据？','提示','warning','取消').then((isConfirmed: any) => {
                    if(isConfirmed){
                        param.n_State = 0;
                        startEndFun(JSON.stringify(param),uploadFun);
                    }
                });
            }
        }
        /*** startEndFun 启用/停用函数 */
        const startEndFun = async(val: any , uploadFun: Function) => {
            let param = JSON.parse(val);
            let res:any;
            res = await SMSIPPlanUpdateState(param);
            if(res.success) uploadFun();
        }

        /*** deleteHandle 删除数据事件 */
        const deleteHandle = async (val: String | Number, updateFun: Function) => {
            ElMessageBox.confirm('请确定删除此条数据？','提示',
                {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }
            )
            .then(async() => {
                let param = {id : val}
                try {
                    let res:any = await SMSIPPlanDelete(param);
                    if(res.success){
                        updateFun()
                    }
                } catch (err) { return }
            })
            .catch(() => {
                ElMessage({
                    type: 'info',
                    message: '已取消',
                })
            })
        };

        /*** cancelUseClick 取消事件 */
        const cancelUseClick = () => {
            isUseDialog.value = false
        };

        /*** controlUseClick 提交事件 */
        const controlUseClick = () => {
            isUseDialog.value = false
        };

        /*** ================================= 详情类数据操作 =================================  */
        const MdetailDialog = ref(false);
        const detailInfo = ref();
        /*** 获取详情接口数据 */
        const getDetailFun = async (id: number) => {
            let res: any = await SMSIPPlanDetail({id: id}); // 详情
            if(res.success){
                let setArr: any = [];
                let detailObj: any = {};
                let smsipPlanUsers = '-';
                let smsipPlanTeamGroups = '-';
                let smsipPlanPoss = '-';
                if(res.data.smsipPlanUsers && res.data.smsipPlanUsers.length !== 0){
                    let setArr: any = [];
                    res.data.smsipPlanUsers.map((item: any) => {
                        setArr.push(item.v_UserName);
                    });
                    smsipPlanUsers = setArr.join(',');
                }
                if(res.data.smsipPlanTeamGroups && res.data.smsipPlanTeamGroups.length !== 0){
                    let setArr: any = [];
                    res.data.smsipPlanTeamGroups.map((item: any) => {
                        setArr.push(item.v_TeamGroupName);
                    });
                    smsipPlanTeamGroups = setArr.join(',');
                }
                if(res.data.smsipPlanPoss && res.data.smsipPlanPoss.length !== 0){
                    let setArr: any = [];
                    res.data.smsipPlanPoss.map((item: any) => {
                        setArr.push(item.v_PosName);
                    });
                    smsipPlanPoss = setArr.join(',');
                }
                detailObj['巡检路线'] = res.data.v_IPPathName ? res.data.v_IPPathName : '-';
                detailObj['风险分区'] = res.data.v_RiskPartitionName ? res.data.v_RiskPartitionName : '-';
                detailObj['计划名称'] = res.data.v_Name ? res.data.v_Name : '-';
                detailObj['巡检分类'] = res.data.v_IPClassName ? res.data.v_IPClassName : '-';
                detailObj['巡检类型'] = res.data.v_IPType ? res.data.v_IPType : '-';
                detailObj['巡检模式'] = res.data.v_IPModeName ? res.data.v_IPModeName : '-';
                detailObj['巡检周期值'] = res.data.n_IPCycleVaule ? res.data.n_IPCycleVaule : '-';
                detailObj['巡检时间单位'] = res.data.v_IPCycleUintName ? res.data.v_IPCycleUintName : '-';
                detailObj['开始日期'] = res.data.d_StartDate ? res.data.d_StartDate.split(' ')[0] : '-';
                detailObj['是否有结束日期'] = res.data.isAppointEndDate ? '是' : '否';
                detailObj['指定结束日期'] = res.data.d_EndDate ? res.data.d_EndDate.split(' ')[0] : '-';
                detailObj['重复几次结束'] = res.data.n_RepetitionTimesEnd ? res.data.n_RepetitionTimesEnd : '-';
                detailObj['巡检开始时间'] = res.data.d_StartTime ? new Date(res.data.d_StartTime).toLocaleTimeString() : '-';
                detailObj['巡检结束时间'] = res.data.d_EndTime ? new Date(res.data.d_EndTime).toLocaleTimeString() : '-';
                detailObj['工作日历'] = res.data.v_WorkingCalendarName ? res.data.v_WorkingCalendarName : '-';
                detailObj['是否启动巡检路线顺序'] = res.data.isUsedPathUnitOrder ? '是' : '否';
                detailObj['是否启动巡检定位'] = res.data.isUsedLocation ? '是' : '否';
                detailObj['巡检允许提前时间值'] = res.data.n_AllowEarlyValue ? res.data.n_AllowEarlyValue : '-';
                detailObj['巡检允许提前时间单位'] = res.data.v_AllowEarlyUnitName ? res.data.v_AllowEarlyUnitName : '-';
                detailObj['巡检允许延后时间值'] = res.data.n_AllowDelayedValue ? res.data.n_AllowDelayedValue : '-';
                detailObj['巡检允许延后时间单位'] = res.data.v_AllowDelayedUnitName ? res.data.v_AllowDelayedUnitName : '-';
                detailObj['任务生成模式'] = res.data.v_TaskGenerateModelName ? res.data.v_TaskGenerateModelName : '-';
                detailObj['巡检记录状态'] = res.data.v_StateName;
                detailObj['任务分配人员'] = smsipPlanUsers;
                detailObj['任务分配班组'] = smsipPlanTeamGroups;
                detailObj['任务分配岗位'] = smsipPlanPoss;
                setArr = [{
                    formTitle: '基础信息',
                    type: 'form',
                    info: detailObj,
                }];
                detailInfo.value = setArr;
                MdetailDialog.value = true;
            }
        }
        /*** 详情 */
        const detailHandle = (id: number) => {
            getDetailFun(id);
        }
        /*** 详情关闭事件 */
        const cancelDetailClick = () => {
            MdetailDialog.value = false;
        }
        /*** ================================= 详情类数据操作 =================================  */
        
        /*** ================================= 查询类数据操作 =================================  */
        let searchObj:any = reactive({
            onlyMyRecord: true,
            isContainMyCreate: true,
            isContainNullEndDate: true,
            n_IPClass: 0,
        });
        const basicsInfo: any = ref([]);
        const searInfo: any = ref();

        /*** 获取需要查询的数据 */
        const searchHandel = (val: any) => {
            searInfo.value = val;
        }

        /*** 查询按钮 */
        const searchClick = () => {
            if(searInfo.value.d_EndDateMax && !searInfo.value.d_StartDateMin){
                ElMessage({
                    type: 'error',
                    message: '请选择开始日期',
                })
                return;
            }
            if(searInfo.value.d_StartDateMin && searInfo.value.d_EndDateMax){
                const dateMin = new Date(searInfo.value.d_StartDateMin);
                const dateMax = new Date(searInfo.value.d_EndDateMax);
                if(dateMin >= dateMax){
                    ElMessage({
                        type: 'error',
                        message: '开始日期不能大于或等于结束日期',
                    })
                    return;
                }
            }
            let newObj = Object.keys(searInfo.value);
            if(newObj.length !== 0){
                newObj.map((i:any) => {
                    searchObj[i] = searInfo.value[i];
                });
            }
            searchObj.n_IPClass = 0;
        };

        /*** 重置按钮 */
        const resetClick = () => {
            searInfo.value = {};
            let newObj = Object.keys(searchObj);
            if(newObj.length !== 0){
                newObj.map((i:any) => {
                    searchObj[i] = ''
                });
            }
            searchObj.onlyMyRecord = true;
            searchObj.isContainMyCreate = true;
            searchObj.isContainNullEndDate = true;
            searchObj.n_IPClass = 0;
            initInfoFun();
        };

        let riskArr: any = [];
        let typeArr: any = [];
        let pathArr: any = [];
        // 获取数据
        const getFun = async () => {
            let ras: any = await SMSIPPathList({}); // 巡检路线
            let rbs: any = await SMSDCRiskPartitionList({}); // 风险分区
            let rcs: any = await sysDictDataList({TypeCode: 'pollingType'}); // 巡检类型
            if(ras.success && ras.data.length !== 0){
                ras.data.map((item: any) => {
                    item.label = item.v_Name;
                    item.value = item.id;
                });
                pathArr = ras.data;
            }
            if(rbs.success && rbs.data.length !== 0){
                rbs.data.map((item: any) => {
                    item.label = item.v_Name;
                    item.value = item.id;
                });
                riskArr = rbs.data;
            }
            if(rcs.success && rcs.data.length !== 0){
                rcs.data.map((item: any) => {
                    item.label = item.value;
                    item.value = item.value;
                });
                typeArr = rcs.data;
            }
        }
        
        /*** 初始化数据 */
        const initInfoFun = () => {
            basicsInfo.value = [{
                    typeId: 's_Risk', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'l_RiskPartitionId', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '风险分区', // placeholder数据
                    defaultProp: riskArr, // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Path', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'l_IPPathId', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '巡检路线', // placeholder数据
                    defaultProp: pathArr, // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 'i_Name', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'v_Name', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '计划名称', // placeholder数据
                    defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Class', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_IPClass', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '巡检分类', // placeholder数据
                    defaultProp: [
                        {label: '设备类', value: 0},
                        {label: '作业活动类', value: 1},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Type', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'v_IPType', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '巡检类型', // placeholder数据
                    defaultProp: typeArr, // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Mode', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_IPMode', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '巡检模式', // placeholder数据
                    defaultProp: [
                        {label: '单次不重复', value: 0},
                        {label: '按小时', value: 1},
                        {label: '按天', value: 2},
                        {label: '按周', value: 3},
                        {label: '按月', value: 4},
                        {label: '按季', value: 5},
                        {label: '按年', value: 6},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 'i_Cycle', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: 'number', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_IPCycleVaule', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '巡检周期值', // placeholder数据
                    defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Unit', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_IPCycleUint', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '巡检时间单位', // placeholder数据
                    defaultProp: [
                        {label: '分钟', value: 0},
                        {label: '小时', value: 1},
                        {label: '天数', value: 2},
                        {label: '周', value: 3},
                        {label: '月', value: 4},
                        {label: '季', value: 5},
                        {label: '年', value: 6},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 'd_Start', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'd_StartDateMin', // 查询字段 --- 必填
                    // searchValMax: 'd_StartDateMax', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '开始日期', // placeholder数据
                    defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 'd_End', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    // searchValMin: 'd_EndDateMin', // 查询字段 --- 必填
                    searchVal: 'd_EndDateMax', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '结束日期', // placeholder数据
                    defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 'i_Repetition', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: 'number', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_RepetitionTimesEnd', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '重复几次结束', // placeholder数据
                    defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Work', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_WorkingCalendar', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '工作日历', // placeholder数据
                    defaultProp: [
                        {label: '每天', value: 0},
                        {label: '工作日', value: 1},
                        {label: '非工作日', value: 2},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Order', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'isUsedPathUnitOrder', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '是否启动巡检路线顺序', // placeholder数据
                    defaultProp: [
                        {label: '是', value: true},
                        {label: '否', value: false},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Location', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'isUsedLocation', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '是否启动巡检定位', // placeholder数据
                    defaultProp: [
                        {label: '是', value: true},
                        {label: '否', value: false},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_Task', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_TaskGenerateModel', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '任务生成模式', // placeholder数据
                    defaultProp: [
                        {label: '手动', value: 0},
                        {label: '自动', value: 1},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                },{
                    typeId: 's_State', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
                    typeNam: '', // 输入类型(number,text等) --- 选填
                    searchVal: 'n_State', // 查询字段 --- 必填
                    defaultVal: '', // 字段默认值 --- 选填
                    placeholder: '启用状态', // placeholder数据
                    defaultProp: [
                        {label: '停用', value: 0},
                        {label: '启用', value: 1},
                    ], // 下拉框中使用，除下拉框外其它情况为空 --- 选填
                    eventType: '', // 事件类型（如burl/change等） --- 选填
                    defaultEvent: '', // 事件名称 --- 选填
                }
            ]
        }
        
        onMounted(async () => {
            await getFun();
            initInfoFun(); 
        });
        /*** ================================= 查询类数据操作 =================================  */

        /*** ================================= 导出数据函数操作 ================================= */
        const excelRef: any = ref(null);
        const handleExport = () => {
            if(excelRef){
                if(excelRef.value.data.length !== 0){
                    let tableExcel: any = [];
                    let tableArr = excelRef.value.data;
                    tableArr.map((item: any) => {
                        let tableObj: any = {};                        
                        tableObj['计划名称'] = item.v_Name ? item.v_Name : '-';
                        tableObj['巡检路线'] = item.v_IPPathName ? item.v_IPPathName : '-';
                        tableObj['风险分区'] = item.v_RiskPartitionName ? item.v_RiskPartitionName : '-';
                        // tableObj['巡检分类'] = item.v_IPClassName ? item.v_IPClassName : '-';
                        tableObj['巡检类型'] = item.v_IPType ? item.v_IPType : '-';
                        tableObj['巡检模式'] = item.v_IPModeName ? item.v_IPModeName : '-';
                        tableObj['巡检周期值'] = item.n_IPCycleVaule ? item.n_IPCycleVaule : '-';
                        tableObj['巡检时间单位'] = item.v_IPCycleUintName ? item.v_IPCycleUintName : '-';
                        tableObj['开始日期'] = item.d_StartDate ? item.d_StartDate.split(' ')[0] : '-';
                        tableObj['是否有结束日期'] = item.isAppointEndDate ? '是' : '否';
                        tableObj['指定结束日期'] = item.d_EndDate ? item.d_EndDate.split(' ')[0] : '-';
                        tableObj['重复几次结束'] = item.n_RepetitionTimesEnd ? item.n_RepetitionTimesEnd : '-';
                        tableObj['巡检开始时间'] = item.d_StartTime ? new Date(item.d_StartTime).toLocaleTimeString() : '-';
                        tableObj['巡检结束时间'] = item.d_EndTime ? new Date(item.d_EndTime).toLocaleTimeString() : '-';
                        tableObj['工作日历'] = item.v_WorkingCalendarName ? item.v_WorkingCalendarName : '-';
                        tableObj['是否启动巡检路线顺序'] = item.isUsedPathUnitOrder ? '是' : '否';
                        tableObj['是否启动巡检定位'] = item.isUsedLocation ? '是' : '否';
                        tableObj['巡检允许提前时间值'] = item.n_AllowEarlyValue ? item.n_AllowEarlyValue : '-';
                        tableObj['巡检允许提前时间单位'] = item.v_AllowEarlyUnitName ? item.v_AllowEarlyUnitName : '-';
                        tableObj['巡检允许延后时间值'] = item.n_AllowDelayedValue ? item.n_AllowDelayedValue : '-';
                        tableObj['巡检允许延后时间单位'] = item.v_AllowDelayedUnitName ? item.v_AllowDelayedUnitName : '-';
                        tableObj['任务生成模式'] = item.v_TaskGenerateModelName ? item.v_TaskGenerateModelName : '-';
                        tableObj['巡检记录状态'] = item.v_StateName ? item.v_StateName : '-';
                        tableExcel.push(tableObj);
                    });
                    exportToExcel(tableExcel,'设备巡检计划.xlsx');
                }else{
                    ElMessage({
                        type: 'error',
                        message: '暂无数据导出',
                    })
                }
            }
        }
        /*** ================================= 导出数据函数操作 ================================= */

        return {
            ...getTableData(SMSIPPlanPage,{},searchObj),
            isUseDialog,
            cancelUseClick,
            controlUseClick,
            nodeClick,
            repairInfo,
            deleteHandle,
            documentClick,
            batchHandle,
            handleSelectionChange,
            selectable,
            syncHandle,

            // 导出Excel
            excelRef,
            handleExport,
            
            // 详情
            MdetailDialog,
            detailHandle,
            detailInfo,
            cancelDetailClick,

            // 查询事件
            basicsInfo,
            searchHandel,
            searchClick,
            resetClick,
        }
    },
} )
</script>
<style lang="scss"> @import '../style/public.scss'; </style>
<style scoped lang="scss">
    ul {
        list-style: none;
        li {
            cursor: pointer;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            text-align: center;
            padding: 10px 0;
        }
    }
    .search-s{
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        width: 100%;
        .search-s-l{
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            width: 98%;
        }
    }
    #patrol-scheme {
        .box-f{
            :deep(.el-form-item__label){
                padding: 0;
            }
        }
        :deep(.el-card__body) {
            height: 100%;
        }
        :deep(.el-card){
            border: none !important;
        }
        .upload-demo{
            margin-left: 12px;
            margin-top: 2px;
        }
        .icon-e{
            :deep(.el-icon){
                margin-right: 0px!important;
            }
        }
    }
.clear-bg{
    background-color: transparent !important;
}
</style>